<template>
  <div class="more-action">
    <van-cell-group v-if="!isReport">
      <!-- 1.绑定一个click事件 $emit("自定义事件名称") -->
      <van-cell @click="disLike">不感兴趣</van-cell>
      <van-cell is-link @click="isReport = true">反馈垃圾内容</van-cell>
      <van-cell>拉黑作者</van-cell>
    </van-cell-group>
    <van-cell-group v-else>
      <van-cell icon="arrow-left" @click="isReport = false">返回</van-cell>
      <van-cell
        v-for="item in reports"
        :key="item.value"
        @click="$emit('report', item.value)"
        >{{ item.label }}</van-cell
      >
    </van-cell-group>
  </div>
</template>

<script>
//引入反馈内容中的常量模块并通过v-for渲染到页面中
import reports from "@/constant/reports.js";
export default {
  name: "MoreAction",
  data() {
    return {
      isReport: false,
      reports: reports
    };
  },
  methods: {
    disLike() {
      this.$emit("disLike");
    }
  }
};
</script>

<style lang="less" scoped>
.more-action {
  border-radius: 4px;
  width: 320px;
}
</style>
